<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="../admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="../admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="../admin/css/animate.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../admin/css/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="../admin/css/demo/webuploader-demo.css">
    <link href="../admin/css/style.css?v=4.0.0" rel="stylesheet">

    <base target="_blank">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                        <div method="get" class="form-horizontal">
                            <div class="ibox-content">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">标题</label>

                                    <div class="col-sm-10">
                                        <input id='inputTitle' type="text" class="form-control" placeholder="标题" value="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">图片</label>

                                    <div class="col-sm-10">
                                        <div class="page-container">
                                            <div id="uploader" class="wu-example">
                                                <div class="queueList">
                                                    <div id="dndArea" class="placeholder">
                                                        <div id="filePicker"></div>
                                                    </div>
                                                </div>
                                                <div class="statusBar" style="display:none;">
                                                    <div class="progress">
                                                        <span class="text">0%</span>
                                                        <span class="percentage"></span>
                                                    </div>
                                                    <div class="info"></div>
                                                    <div class="btns">
                                                        <div id="filePicker2"></div>
                                                        <div class="uploadBtn">开始上传</div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" style="display:none;">
                                    <label class="col-sm-2 control-label">图片ID</label>
                                    <div class="col-sm-10">
                                        <input id='inputImgId' type="text" class="form-control" placeholder="ID" value="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">详细</label>
                                    <div class="col-sm-10">
                                        <textarea id='inputDesc' type="text" class="form-control" placeholder="详细" value=""></textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">购买地址</label>

                                    <div class="col-sm-10">
                                        <input id='inputSaleUrl' type="text" class="form-control" placeholder="购买地址" value="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <a class="btn btn-primary" id="save" >保存内容</a>
                                        <a class="btn btn-white" >取消</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>              
    </div>

    <!-- 全局js -->
    <script src="../admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="../admin/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="../admin/js/plugins/webuploader/webuploader.min.js"></script>
    <script src="../admin/js/demo/webuploader-demo.js"></script>
    <!-- 自定义js -->
    <script src="../admin/js/content.js?v=1.0.0"></script>
    <script type="text/javascript">

    var BASE_URL = '../admin/js/plugins/webuploader';

    $('#save').click(function(){
        var title=$('#inputTitle').val();
        var imgId=$('#inputImgId').val();
        var desc=$('#inputDesc').val();
        var url=$('#inputSaleUrl').val();

        $.ajax({
            type:'POST',
            url:'./couponAdd',
            data:{title:title,imgId:imgId,desc:desc,saleUrl:url},
            dataType:'json',
            success:function(data){
                //当你在iframe页面关闭自身时
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭     
                // window.location.reload();//刷新当前页面.
            }               
        })
    })


    </script>
</body>

</html>